<?php

/**
 * RecepcionEmails filter form base class.
 *
 * @package    costabravasfr
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseRecepcionEmailsFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'vivienda'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'email'              => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'emailvalid'         => new sfWidgetFormChoice(array('choices' => array('' => '', 'y' => 'y', 'n' => 'n'))),
      'datainici'          => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'datafin'            => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'mensaje'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'casasvisitadas'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'idioma'             => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'enews'              => new sfWidgetFormChoice(array('choices' => array('' => '', 'y' => 'y', 'n' => 'n'))),
      'ip'                 => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'fechahorarecepcion' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'vivienda'           => new sfValidatorPass(array('required' => false)),
      'email'              => new sfValidatorPass(array('required' => false)),
      'emailvalid'         => new sfValidatorChoice(array('required' => false, 'choices' => array('y' => 'y', 'n' => 'n'))),
      'datainici'          => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'datafin'            => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'mensaje'            => new sfValidatorPass(array('required' => false)),
      'casasvisitadas'     => new sfValidatorPass(array('required' => false)),
      'idioma'             => new sfValidatorPass(array('required' => false)),
      'enews'              => new sfValidatorChoice(array('required' => false, 'choices' => array('y' => 'y', 'n' => 'n'))),
      'ip'                 => new sfValidatorPass(array('required' => false)),
      'fechahorarecepcion' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('recepcion_emails_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'RecepcionEmails';
  }

  public function getFields()
  {
    return array(
      'id'                 => 'Number',
      'vivienda'           => 'Text',
      'email'              => 'Text',
      'emailvalid'         => 'Enum',
      'datainici'          => 'Date',
      'datafin'            => 'Date',
      'mensaje'            => 'Text',
      'casasvisitadas'     => 'Text',
      'idioma'             => 'Text',
      'enews'              => 'Enum',
      'ip'                 => 'Text',
      'fechahorarecepcion' => 'Date',
    );
  }
}
